<?php if (!defined('MAX_ON')){echo "<h1>ACCESS DENIED</h1>You cannot access this file directly.";exit();} ?>
<?php if ($template_hook=='start'){ ?>
<?php }elseif ($template_hook=='1'){ ?>
<?php if ($pages > 1) echo $links . '<br /><br />'; ?>
	<table cellpadding="0" cellspacing="2" style="width: 100%">
<?php }elseif ($template_hook=='2'){ ?>
<?php if (($count % 3) == 0 || $count == 0) echo '<tr>'; ?>
		<td style="vertical-align: top; width: 32%">
	
			<table style="border: 1px solid #C7C7C7" class="forum-index" cellpadding="0" cellspacing="0">
				
				<tr>
					<td style="background-color: #DFECF1; background-image: url('<?php echo $max_domain; ?>/includes/pages/gallery/images/bg.png'); padding: 5px; text-align: center">
						<a href="<?php echo max_link('index.php?page=gallery&act=view-cat&id=' . $row['id'], 'gallery/view-cat/' . $row['id']); ?>"><?php echo $row['name']; ?></a>
					</td>
				</tr>
				
				<tr>
					<td class="forum-jump-content forum-index-top" style="border-bottom: 3px double #C7C7C7; height: 200px; text-align: center; line-height: 0px">
						
						<a href="<?php echo max_link('index.php?page=gallery&act=view-cat&id=' . $row['id'], 'gallery/view-cat/' . $row['id']); ?>">
						
							<img src="<?php echo $max_domain . $row['image']; ?>" border="0" /><br />
							
							<?php if ($gallery['settings']['image_reflections'] == 1){ ?>
							
								<img src="<?php echo $max_domain . $row['r_image']; ?>" border="0" />
							
							<?php } ?>
						
						</a>
						
					</td>
				</tr>
				
				<tr>
					<td style="background-color: #DFECF1; height: 25px; padding: 5px; text-align: center">
						&nbsp;<?php echo nl2br($row['description']); ?>
					</td>
				</tr>
			
			</table>
		
		</td>

		<?php
			# Blank cells
			if (($count + 1) == $totalRows)
			{
				for ($i = 0; $i < (3 - $rowNum); ++$i)
				{
					echo '<td style="width: 2%"></td>';
					echo '<td style="vertical-align: top; width: 32%">&nbsp;</td>';
				}
			}
			
			# New row?
			if ((($count + 1) % 3) == 0 || ($count + 1) == $totalRows)
			{
				echo '</tr>';
				echo '<tr style="height: 15px"><td></td></tr>';
			}
			# Or spacer between cells?
			else
			
				echo '<td style="width: 2%"></td>';
		?>

<?php }elseif ($template_hook=='3'){ ?>
	</table>
<?php if ($pages > 1) echo $links; ?>
<?php }elseif ($template_hook=='end'){ ?>		
<?php } ?>